#!/usr/bin/python
# -*- coding: utf-8 -*-

import os, sys
import gtk
import glib
from django.utils.translation import ugettext_lazy as _

class Properties:
    def __init__(self):
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.set_title("FeedBar Options")
        self.window.set_icon_from_file('/usr/share/pixmaps/feedbar.png')
#        self.window.set_resizable(False)
        self.window.resize(500, 350)
        self.window.move((gtk.gdk.screen_width()/2)-(500/2), (gtk.gdk.screen_height()/2)-(350/2))
#        e = gtk.EventBox()
        screen = self.window.get_screen()
        rgba = screen.get_rgba_colormap()
        self.window.set_colormap(rgba)


        self.settings = gtk.settings_get_default()
        self.settings.set_property("gtk-button-images", True)

        self.hbuttonbox = gtk.HButtonBox()
        self.hbuttonbox.set_layout(gtk.BUTTONBOX_SPREAD)

        button = gtk.Button(stock=gtk.STOCK_APPLY)
        self.hbuttonbox.pack_start(button)
        button = gtk.Button(stock=gtk.STOCK_CLOSE)
        self.hbuttonbox.pack_end(button)


        self.generalFrame = gtk.Frame()
        hbox1 = gtk.HBox()
        label = gtk.Label("Move Speed")
        label.set_alignment(xalign=0, yalign=0.5)
        label.set_tooltip_text("The speed of the moving text")
        hbox1.pack_start(label)
        hscale = gtk.HScale()
        hscale.set_tooltip_text("Pixels per Second")
        hscale.set_value_pos(gtk.POS_RIGHT)
        hbox1.pack_end(hscale)


        hbox2 = gtk.HBox()
        label = gtk.Label("Fetching Interval")
        label.set_alignment(xalign=0, yalign=0.5)
        label.set_tooltip_text("The time until the feeds are updated again")
        hbox2.pack_start(label)
        spinbutton = gtk.SpinButton()
        hbox2.pack_start(spinbutton, padding = 5)
        combobox = gtk.combo_box_new_text()
        combobox.append_text("Seconds")
        combobox.append_text("Minutes")
        combobox.append_text("Hours")
        combobox.append_text("Days")
        combobox.set_active(1)
        hbuttonbox = gtk.HButtonBox()
        hbuttonbox.pack_start(combobox)
        hbuttonbox.set_layout(gtk.BUTTONBOX_END)
        hbox2.pack_start(hbuttonbox, expand = False)

        hbox3 = gtk.HBox()
        label = gtk.Label("Position")
        label.set_alignment(xalign=0, yalign=0.5)
        hbox3.pack_start(label)
        combobox = gtk.combo_box_new_text()
        combobox.append_text("Top")
        combobox.append_text("Bottom")
        combobox.set_active(1)
        hbuttonbox = gtk.HButtonBox()
        hbuttonbox.pack_start(combobox)
        hbuttonbox.set_layout(gtk.BUTTONBOX_END)
        hbox3.pack_start(hbuttonbox, padding = 5)
        spinbutton = gtk.SpinButton()
#        spinbutton.set_layout(gtk.BUTTONBOX_END)
        hbox3.pack_start(spinbutton, expand = False)
        hbox3.set_homogeneous(True)
        

        hbox4 = gtk.HBox()
        vbox = gtk.VBox()
        check_button = gtk.CheckButton(label="Always on Top")
        vbox.pack_start(check_button)
        check_button = gtk.CheckButton(label="Reserve Window Space")
        vbox.pack_start(check_button)
        hbox4.pack_start(vbox)
        vbox2 = gtk.VBox()
        check_button = gtk.CheckButton(label="Run on Startup")
        vbox2.pack_start(check_button)
        check_button = gtk.CheckButton(label="Something Here")
        vbox2.pack_start(check_button)
        hbox4.pack_start(vbox2)

        generalvbox = gtk.VBox()
        generalvbox.set_border_width(25)
        generalvbox.pack_start(hbox1)
        generalvbox.pack_start(hbox2)
        generalvbox.pack_start(hbox3)
        generalvbox.pack_start(hbox4)
        self.generalFrame.add(generalvbox)




        self.feedsFrame = gtk.Frame()
        vbox = gtk.VBox()

        hbox = gtk.HBox()

        scrolledwindow = gtk.ScrolledWindow()
        self.treeview = gtk.TreeView()
        cell = gtk.CellRendererText()
        self.tvcolumn = gtk.TreeViewColumn("Test 1st", cell)
        self.treeview.append_column(self.tvcolumn)
        scrolledwindow.add_with_viewport(self.treeview)
        scrolledwindow.set_property("hscrollbar-policy", gtk.POLICY_AUTOMATIC)
        scrolledwindow.set_property("vscrollbar-policy", gtk.POLICY_AUTOMATIC)
        hbox.pack_start(scrolledwindow)

        vbuttonbox = gtk.VButtonBox()
        button = gtk.Button(stock=gtk.STOCK_GOTO_TOP)
        vbuttonbox.pack_start(button)
        button = gtk.Button(stock=gtk.STOCK_GO_UP)
        vbuttonbox.pack_start(button)
        button = gtk.Button(stock=gtk.STOCK_ADD)
        vbuttonbox.pack_start(button)
        button = gtk.Button(stock=gtk.STOCK_REMOVE)
        vbuttonbox.pack_start(button)
        button = gtk.Button(stock=gtk.STOCK_GO_DOWN)
        vbuttonbox.pack_start(button)
        button = gtk.Button(stock=gtk.STOCK_GOTO_BOTTOM)
        vbuttonbox.pack_start(button)
        vbuttonbox.set_layout(gtk.BUTTONBOX_CENTER)
        
        hbox.pack_end(vbuttonbox, False)
        hbox.set_homogeneous(False)
        vbox.pack_start(hbox)

        hbuttonbox = gtk.HButtonBox()
        button = gtk.Button(stock=gtk.STOCK_YES)
        hbuttonbox.pack_start(button)
        button = gtk.Button(stock=gtk.STOCK_YES)
        hbuttonbox.pack_start(button)
        button = gtk.Button(stock=gtk.STOCK_YES)
        hbuttonbox.pack_start(button)
        vbox.pack_end(hbuttonbox, False, padding = 5)


        self.feedsFrame.add(vbox)





        self.aboutFrame = gtk.Frame()
        self.Label2 = gtk.Label("Hi")
        self.Label2.set_line_wrap(True)
        self.aboutFrame.add(self.Label2)



        self.notebook = gtk.Notebook()
        self.notebook.append_page(self.generalFrame, gtk.Label("General"))
        self.notebook.child_set_property(self.generalFrame, "tab-expand", True)
        self.notebook.append_page(self.aboutFrame, gtk.Label("Looks"))
        self.notebook.append_page(self.feedsFrame, gtk.Label("Feeds"))
        self.notebook.append_page(self.aboutFrame, gtk.Label("Customize"))
        self.notebook.append_page(self.aboutFrame, gtk.Label("About"))
        self.notebook.child_set_property(self.aboutFrame, "tab-expand", True)
        self.notebook.set_property('homogeneous', True)


        self.vbox = gtk.VBox()
        self.vbox.pack_start(self.notebook)
        self.vbox.pack_start(self.hbuttonbox, False, padding = 20)
        self.vbox.set_homogeneous(False)

        self.window.add(self.vbox)

        self.window.show_all()


    def main(self):
        gtk.main()


if __name__ == "__main__":
    properties = Properties()
    properties.main()

